import request from "../utils/request";

interface ResDataMOdel {
    code: number;
    data: KeyWordModel;
}

// 泰顺默认关键字
export interface DefaultKeyWordMOdel {
    keyword: string;
    schemeUrl: string;
    highlight: number | undefined;
    hidden: number | undefined;
    type: number | undefined;
    algSort: boolean | undefined;
    extra: {
        resource: {
            materialName: string;
            resourcesId: number | undefined;
            materialId: number | undefined;
        };
    };
}
// 热门关键字
interface HotKeyWordModel {
    keyword: string;
    schemeUrl: null;
    highlight: number | undefined;
    hidden: number | undefined;
    type: number | undefined;
    algSort: boolean | undefined;
    extra: HotExtraModel;
}
// 热门关键字extra
interface HotExtraModel {
    materialContentFrom: number | undefined;
    rcmdSort: boolean;
    taskType: number | undefined;
    alg_personalized: string;
    itemFrom: number | undefined;
    resourcesId: number | undefined;
}
export interface KeyWordModel {
    defaultKeyword: DefaultKeyWordMOdel;
    defaultKeywords: DefaultKeyWordMOdel[];
    hotKeywordVOList: HotKeyWordModel[];
    colorfulEggList:[]
}
interface HotSearchData{
  code:number,
  data:string[]
}
export default {
    reqKeyword() {
        return request.get<any, ResDataMOdel>("/api/xhr/search/init.json");
    },
    reqHotSearch(data:object){
      return request.post<any,HotSearchData>('/api/xhr/search/searchAutoComplete.json',data)
    }
};
